package br.ufmg.dcc.vod.remoteworkers.scheduler;

import br.ufmg.dcc.vod.remoteworkers.Command;
import br.ufmg.dcc.vod.remoteworkers.processor.Processor;

public class ProcessorEntry {

	public enum ProcessorState {DOWN, IDLE, WORKING}

	private ProcessorState state;
	private Command currentCommand;
	private Processor instance;
	
	public ProcessorEntry() {
		setDown();
	}
	
	public void setWorking(Command command) {
		this.state = ProcessorState.WORKING;
		this.currentCommand = command;
	}
	
	public void setInstance(Processor instance) {
		this.instance = instance;
	}
	
	public void setIdle() {
		this.state = ProcessorState.IDLE;
		this.currentCommand = null;
	}
	
	public void setDown() {
		this.state = ProcessorState.DOWN;
		this.currentCommand = null;
		this.instance = null;
	}

	public ProcessorState getState() {
		return state;
	}
	
	public Command getCurrentCommand() {
		return currentCommand;
	}

	public Processor getInstance() {
		return instance;
	}
}